Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse glossary bib files to populate intellisense #4491

Merged
merged 6 commits into from
Dec 26, 2024
Merged

Conversation

jlelong
Copy link
Collaborator

@jlelong jlelong commented Dec 25, 2024

Close #4472

This PR implements the use of glossary .bib to populate intellisense.
As glossary intellisense treats glossary and acronym entries differently, we do the same when parsing .bib files. Currently only @entry entries are considered as glossary entries. Everything else is considered as an acronym entry.

Hopefully I will manage to add some automatic tests but some more intensive testing from people who actually use bib2gls is more than welcome. @LeoJhonSong Could we count on your feedback?

@James-Yu A lot of the newly added code looks very similar to the one used in completion/completer/citation.ts. Yet, factorizing both is not so obvious and would require to extract sub functions. I will think of it but feel free to share your thoughts if any.

Btw Merry Christmas @James-Yu

@LeoJhonSong
Copy link

@jlelong Sure, I got your back! Thank really much for the commit in Christmas haha 😄

I can catch up with updated extention once released and test it out. Also, I can provide three .bib files I used if helpful. Please feel free to let me know if there is anything else I can help.

BTW as an glossaries-extra user, from my point of view, "everything else from @entry" could be better described by abbreviation, but not acronym.

@James-Yu
Copy link
Owner

Merry Chrismas @jlelong @LeoJhonSong and everyone!

Yeah the implementation looks quite good to me. I think it's fine to duplicate these functions, who knows if they may diverge or not later. Feel free to merge when you think good!

@jlelong
Copy link
Collaborator Author

jlelong commented Dec 26, 2024

@LeoJhonSong It would definitely be helpful if you could share a real life .bib file.

Following your remark, I have googled for an explanation on the difference between abbreviation and acronym and came up with https://tex.meta.stackexchange.com/questions/6516/the-acronyms-and-abbreviations-tags. I am afraid it is not crystal clear but in any case, it seems equivalent from the intellisense point of view :

  • Entries defined by \newglossaryentry, \provideglossaryentry, \longnewglossaryentry or \longprovideglossaryentry are considered as glossary entries.
  • Entries defined by \newacronym, \newabbreviation or \newabbr are considered as acronyms (or non glossary entries). These entries are only considered for intellisense completion of commands starting with \ac.

Let me know if the above approach complies with the typical usage of the glossaries and glossaries-extra packages.

@jlelong
Copy link
Collaborator Author

jlelong commented Dec 26, 2024

I have finally decided to factorize the recursive computation of included .bib files between citation.ts and glossary.ts. Meanwhile, I discovered that a very similar function was already implemented in cache.ts. We had getIncludedBib in cache.ts and getIncludedBibs in citation.ts. This is now fixed.

@LeoJhonSong You can try the new feature by installing the extension zipped in
https://github.com/James-Yu/LaTeX-Workshop/actions/runs/12504011737/artifacts/2363328704
I am waiting for your feedback before proceeding with the merge.

@LeoJhonSong
Copy link

@jlelong Sure thing! Here comes symbols.bib, abbreviations.bib and Notations.bib.

I will download and try the extension now😄

@LeoJhonSong
Copy link

LeoJhonSong commented Dec 26, 2024

I have finally decided to factorize the recursive computation of included .bib files between citation.ts and glossary.ts. Meanwhile, I discovered that a very similar function was already implemented in cache.ts. We had getIncludedBib in cache.ts and getIncludedBibs in citation.ts. This is now fixed.

@LeoJhonSong You try the new feature by installing the extension zipped in https://github.com/James-Yu/LaTeX-Workshop/actions/runs/12504011737/artifacts/2363328704 I am waiting for your feedback before proceeding with the merge.

Cool, the intellisence works perfectly for me! LGTM @jlelong

@jlelong jlelong merged commit c3a5952 into master Dec 26, 2024
11 checks passed
@jlelong jlelong deleted the 4472_bib_glossary branch December 26, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

intellisence for entries in glossary
3 participants